package host.haiwai.mapstruct;

import host.haiwai.entity.Menu;
import host.haiwai.vo.MenuTreeVo;
import host.haiwai.vo.MenuVo;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;

import java.util.List;

/**
 * Mapstruct 转换pojo转vo工具类
 */
@Mapper
public interface MenuTreeMapstruct {
    MenuTreeMapstruct mapper = Mappers.getMapper(MenuTreeMapstruct.class);

    @Mappings({
            @Mapping(source = "menuName",target = "title"),
            @Mapping(source = "menuId",target = "id"),
            @Mapping(source = "children",target = "children")
    })
    MenuTreeVo menuLayerPojo2Vo(Menu menu);

    List<MenuTreeVo> menuLayerTree2Vo(List<Menu> list);
}
